package com.hibernate;



import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

public class AggrStore{
public static void main(String[] args) {
	
	//creating configuration object
	Configuration cfg=new Configuration();
	cfg.configure("hibernate.cfg.xml");//populates the data of the configuration file
	
	//creating seession factory object
	SessionFactory factory=cfg.buildSessionFactory();
	
	//creating session object
	Session session=factory.openSession();
	
	//creating transaction object
	Transaction t=session.beginTransaction();
		
	Aggregate a=new Aggregate();
	
	a.setAggrid("aggr10");
	a.setState("online");
	a.setStatus("raid4");
	a.setUtilization("134kb");
	
	session.persist(a);
	t.commit();//transaction is commited
	session.close();
	
	System.out.println("successfully saved");
	
}
}

